home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 075 (1990-05)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 075 (1990-05)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / p2c / README < prev    next >
Text File  |  1990-05-13  |  6KB  |  133 lines

  1.  
  2. This directory contains "p2c" version 1.13, a Pascal to C translator.
  3.  
  4. "p2c"  Copyright 1989  Dave Gillespie
  5.                        256-80 Caltech
  6.                        Pasadena CA 91125
  7.                        daveg@csvax.caltech.edu, cit-vax!daveg
  8.  
  9.  
  10. This program is distributed under the terms of the GNU License Agreement.
  11. See the file src/COPYING for details.
  12.  
  13. The GNU License Agreement restrictions do _not_ apply to code generated
  14. by p2c, nor to the p2c run-time files "p2clib.c" and "p2c.h".
  15.  
  16.  
  17.  
  18. QUICK INSTRUCTIONS
  19.  
  20. The top-level Makefile in this directory tree knows how to build
  21. p2c and run it on some example programs.  The compiled p2c will be
  22. "installed" in this directory tree rather than in public directories.
  23. (For a full public installation, see the instructions below.)
  24. Just type "make test" to build p2c and run the examples.
  25.  
  26.  
  27.  
  28. FULL INSTALLATION INSTRUCTIONS
  29.  
  30. For a complete system, you must:
  31.  
  32.    a) Create a home directory for p2c, such as /usr/lib/p2c.  The exact
  33.       location does not matter, as long as p2c knows how to find it.
  34.  
  35.    b) Create an include directory, such as /usr/include/p2c.  If you are
  36.       unable to arrange for an include directory, you can edit sys.p2crc
  37.       so as not to require one, or compile translated code with a
  38.       suitable -I flag.
  39.  
  40.    c) Install the executable "p2c" in /usr/bin or elsewhere on the
  41.       standard search path.
  42.  
  43.    d) Install the run-time library "libp2c.a" in /usr/lib or elsewhere
  44.       on the standard library search path.
  45.  
  46.    e) Install the Unix manual entry "p2c.1" in /usr/man/man1.  If you
  47.       have a "man1.Z" directory instead (for compressed man pages)
  48.       you will have to edit the Makefile to use a "compress" command.
  49.  
  50.    f) Install the necessary files in the p2c home directory.
  51.  
  52. The Makefile is initially set up to create a private version of p2c in
  53. the p2c distribution directory.  Just "cd src" and "make install" to
  54. perform the above steps.  This will place the p2c executable, run-time
  55. library, include directory, and man page in the "home" subdirectory of
  56. the distribution directory.  The man page will be in human-readable form.
  57.  
  58. To compile code that has been translated by this private version of p2c,
  59. use the command:
  60.  
  61.     cc -I. foo.c libp2c.a
  62.  
  63. (assuming "home," i.e., HOMEDIR, is the current directory.)
  64.  
  65. The "examples" subdirectory contains a few sample Pascal programs and
  66. a Makefile to translate and compile them.
  67.  
  68. To install p2c for public use, edit the Makefile to indicate the correct
  69. directory names.  Suggested names are included as comments.  Also change
  70. MANFILE as shown to store the man page in the proper form for the "man"
  71. command.
  72.  
  73.     HOMEDIR      default /usr/lib/p2c       Home directory
  74.     INCDIR       default /usr/include/p2c   Include directory
  75.     BINDIR       default /usr/bin           Directory for "p2c" executable
  76.     LIBDIR       default /usr/lib           Directory for "libp2c.a" library
  77.     MANDIR       default /usr/man/man1      Directory for "p2c.1" manual page
  78.  
  79. Make sure the home and include directories have been created and are
  80. writable, and that the bin, lib, and man directories are writable.
  81. (You may have to be root to do this.)  Recompile "p2c" with another
  82. "make install".  Be sure "trans.c" is recompiled with the new value
  83. of HOMEDIR; you can ensure this by doing "make newhome" before
  84. "make install".  You can always type "make" with no arguments to
  85. compile without installing.
  86.  
  87. HP Pascal Workstation System users will want to copy all of ../HP/include
  88. into the new p2c include directory, and copy all of ../HP/import into
  89. the p2c home directory.  You will have to write emulations for the
  90. functions you use out of these modules.  (The HP directories are
  91. present in the ftp distribution only---they have been omitted from
  92. the shar'd version to save space.)
  93.  
  94. Incomplete interface texts for standard Turbo units are included in
  95. turbo.imp.  Turbo users will have to flesh these out and write emulations
  96. for whatever parts of the Turbo runtime library they need.
  97.  
  98. If you wish to edit various system-wide configuration parameters, it is
  99. better to put them in loc.p2crc than in sys.p2crc.  As an example, on a
  100. Turbo-oriented environment you may wish to add
  101.  
  102.     Language Turbo
  103.  
  104. to the loc.p2crc file to replace the normal default (HP Pascal).
  105.  
  106.  
  107.  
  108. PORTABILITY
  109.  
  110. P2c was originally developed on a homebrew C compiler on the HP Pascal
  111. Workstation operating system.  Current development takes place on HP-UX,
  112. which is System V based.  The translator has also been compiled and used
  113. on Sun-3's, so presumably it is fairly portable among 32-bit Unix machines.
  114.  
  115. Many parts of the code will have to be adjusted in order for p2c to work
  116. on a machine with 16-bit ints.  I have never had reason or opportunity to
  117. track these down since I don't have access to such a machine.  Please note
  118. that code _generated_ by p2c works with either size of int even though p2c
  119. itself does not.
  120.  
  121. If your compiler supports ANSI prototypes, most of the 16-bit portability
  122. problems will go away except for possible %d/%ld sloppiness in sprintf control
  123. strings.  There may be places where p2c tries to cast a pointer into an
  124. int, but I believe all such cases use longs consistently.  You will have
  125. a problem if your long type is not large enough to store a pointer.
  126.  
  127. Because p2c was developed to run under Unix, it is sloppy about memory
  128. allocation.  Some data structures are allocated but never freed.  Profiles
  129. show that the waste is not too great in most cases, but if it is a problem
  130. you may have to write a garbage collector (this shouldn't be too hard if you
  131. only run the collector after translating each procedure).
  132.  
  133.